#ifndef STACK_H
#define STACK_H




struct ElemType
{
	int x;
	int y;
	int z;
	unsigned char value;
};



struct Stack {
    ElemType *stack ;   // the element of the stack 
	
    int top;            // the flag of the top of the stack
    int MaxSize;            // the max length of the stack
};

void InitStack (Stack &S);        //Initialize the stack

int EmptyStack (Stack S);         //whether the stack is empty

void Push(Stack &S, ElemType item);    //push the item into the stack

ElemType Pop(Stack &S, int *itop);              //pop the item

ElemType Peek( Stack S );        //get the top item of the stack

void ClearStack( Stack &S );     //destroy the stack


void StackOperate(int ***ImageSrc, 
				  int i, int j, int k,
				  int row, int col, int height,
				  int ***pilabel, int iLabelvalue, Stack &t, int iSortValue);

void Imagelabel(int ***ImageSrc, int ***pilabel, int row, int col, int height, int *iLabelNum, int iSortValue);

#endif